package com.example.demo1;

import com.example.demo1.Book;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

public interface BookRepository extends JpaRepository<Book, Long> {
    Page<Book> findByTitleContaining(String title, Pageable pageable);
    Page<Book> findByAvailable(Boolean available, Pageable pageable);
    Page<Book> findByTitleContainingAndAvailable(String title, Boolean available, Pageable pageable);

    // 检查 ISBN 唯一性
    boolean existsByIsbn(String isbn);
}